from Products.Five import BrowserView
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile

class ZViewer(BrowserView):
    template = ViewPageTemplateFile("pdfflashviewer.pt")

    def __call__(self):
        return self.template()


class SwfView(BrowserView):
    __call__ = lambda self : self.getSwf()

    def getSwf(self):
        response = self.request.response
        response.setHeader('Content-type', 'application/x-shockwave-flash')
        #import pdb; pdb.set_trace()
        base_dir = '/'.join(__file__.split('/')[:-1])
        file = open('%s/zViewer/test.swf' % base_dir,'r')
        file.seek(0)
        response.write(file.read())
        file.close()
